package com.sky.service.impl;

import com.sky.entity.LogicFlow;
import com.sky.mapper.CompetionCategoryMapper;
import com.sky.mapper.LogicFlowMapper;
import com.sky.service.LogicFlowControllerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class LogicFlowControllerServiceImpl implements LogicFlowControllerService {
    @Autowired
    private LogicFlowMapper logicFlowMapper;
    @Autowired
    private CompetionCategoryMapper competionCategoryMapper;
    @Override
    @Transactional
    public void add(LogicFlow logicFlow) {
        logicFlowMapper.add(logicFlow);
    }

    @Override
    public void update(LogicFlow logicFlow) {
        logicFlowMapper.update(logicFlow);
        competionCategoryMapper.updateType(1,logicFlow.getCategoryId());
    }

    @Override
    public LogicFlow get(String id) {
        return logicFlowMapper.getByCategoryId(id);
    }

}
